<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>wangStudy</title>
    <!--引入axios库-->
    <script src="js/axios.min.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入VUE库 -->
    <script src="js/vue.min.js"></script>
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>

    <!-- 引入 css -->
    <link href="https://cdn.jsdelivr.net/npm/@wangeditor/editor@latest/dist/css/style.css" rel="stylesheet">

    <!-- 引入 js -->
    <script src="https://cdn.jsdelivr.net/npm/@wangeditor/editor@latest/dist/index.min.js"></script>
    <script>
        var E = window.wangEditor; // 全局变量
        const { createEditor, createToolbar } = window.wangEditor
        const editorConfig: Partial<IEditorConfig> = {}
        editorConfig.placeholder = '请输入内容'
        editorConfig.onChange = (editor: IDomEditor) => {
            // 当编辑器选区、内容变化时，即触发
            console.log('content', editor.children)
            console.log('html', editor.getHtml())
        }

        // 工具栏配置
        const toolbarConfig: Partial<IToolbarConfig> = {}

        // 创建编辑器
        const editor = createEditor({
            selector: '#editor-container',
            config: editorConfig,
            mode: 'default' // 或 'simple' 参考下文
        })
        // 创建工具栏
        const toolbar = createToolbar({
            editor,
            selector: '#toolbar-container',
            config: toolbarConfig,
            mode: 'default' // 或 'simple' 参考下文
        })
    </script>

</head>
<body>
<div id="app">
    1
    <br>
    <br>
    <br>
    <hr>
    <hr>
    1
    1
    <div id="toolbar-container"></div>
    <div id="editor-container"></div>
<el-button @click="">查看</el-button>
</div>
</body>
<script>
    var v=new Vue({
        el:"#app",
        data:{

        },
        methods:{
            getTextbox(){
                var ht=editor.getHtml()
                console.log("ht="+ht)
            }
        },
    })
</script>
</html>